<#assign f = JspTaglibs["http://www.casic304.cn/f"] />
<div>
    <table id="wQbdTeamPeopleTable" lay-filter="wQbdTeamPeopleTable"></table>
    <form class="reportList-isShow">
        <input type="hidden" id="successDataId" name="successDataId">
    </form>
</div>
<!-- 右侧工具栏 -->
<script type="text/html" id="wQbdTeamPeopleRightToolsBar">
    <a class="RightBtn" lay-event="particulars">详情</a>
</script>
<script>
    //一般直接写在一个js文件中
    layui.use(['index', 'table', 'publicMethods', 'jquery', 'layer'], function () {
        var table = layui.table;
        var publicMethods = layui.publicMethods;
        var $ = layui.jquery;
        var layer = layui.layer;
        var tableH=publicMethods.layerHeight();
        var dataId = "${dataId}";
        //第一个实例
        table.render({
            elem: '#wQbdTeamPeopleTable'
            ,height:tableH
            ,url: serverPath.qbdmsPath + '/qbdms/wQbdTeamPeople/reportList?id=' + dataId + "&tableName=W_QBD_TEAM_PEOPLE"
            ,page: false //开启分页
            // ,toolbar: '#wQbdTeamPeopleHeaderToolsBar'
            ,method: 'post'
            ,autoSort: false //是否排序
            ,cols: [[
                {type: 'checkbox', fixed: 'left'}
                ,{field: 'sn', type: 'numbers', title: '序号', fixed: 'left'}
                ,{field: 'name', title: '姓名',minWidth:100}
                ,{field: 'sex', title: '性别',minWidth:90}
                ,{field: 'works', title: '工作单位',minWidth:110}
                ,{field: 'qualification', title: '审核员资格',minWidth:130}
                ,{field: 'contactinformation', title: '联系方式',minWidth:100}
                ,{field: 'address', title: '地址',minWidth:110}
                ,{field: 'jiguan', title: '籍贯',hide:true}
                ,{field: 'minzu', title: '民族',hide:true}
                //如需转换为:yyyy-MM-dd HH:mm:ss: return publicMethods.timeData(d.birthday,"1");
                //如需转换为HH:mm:ss: return publicMethods.timeData(d.birthday,"2");
                // 当前转换后的格式为yyyy-MM-dd: return publicMethods.timeData(d.birthday);
                ,{field: 'birthday', title: '出生日期',hide:true, templet: function (d) {
                        return publicMethods.timeData(d.birthday);
                    }}
                ,{field: 'peopletype', title: '人员类别',hide:true}
                ,{field: 'remark', title: '备注',hide:true}
                ,{field: 'phone', title: '座机',hide:true}
                ,{field: 'idcode', title: '证件号码',hide:true}
                ,{
                    fixed: 'right',
                    title: '管理',
                    align:'center',
                    width:80,
                    toolbar: '#wQbdTeamPeopleRightToolsBar'
                }]],done:function () {}
        });

        table.on('tool(wQbdTeamPeopleTable)', function(obj) {
            var data = obj.data, //获得当前行数据
                    layEvent = obj.event; //获得 lay-event 对应的值
            switch(layEvent){
                case "particulars":
                    var height=publicMethods.layHeight('body');
                    layer.open({
                        type: 2,
                        area: ['96%', height],
                        title: ['质量体系审核员信息'],
                        content: serverPath.qbdmsPath + '/qbdms/wQbdTeamPeople/view/particulars?id=' + data.id + "&isClose=true"
                    });
                    break;
            }
        });

        table.on('checkbox(wQbdTeamPeopleTable)', function (obj) {
            if (obj.type == "all") {
                if (obj.checked) {
                    $("input[name='successDataId']").val("");
                    var checkStatus = table.checkStatus('wQbdTeamPeopleTable');
                    var valArr = checkStatus.data;//选中行数据
                    var ceshiVal = $("input[name='successDataId']").val();
                    for (var i = 0; i < valArr.length; i++) {
                        ceshiVal = ceshiVal + valArr[i].id + ",";
                    }
                    $("input[name='successDataId']").val(ceshiVal);
                } else {
                    $("input[name='successDataId']").val("");
                }
            } else {
                if (obj.checked) {
                    var ceshiVal = $("input[name='successDataId']").val();
                    $("input[name='successDataId']").val(ceshiVal + obj.data.id + ",");
                } else {
                    var ceshiVal = $("input[name='successDataId']").val();
                    var newVal = "";
                    var valArr = ceshiVal.split(obj.data.id + ",");
                    for (var i = 0; i < valArr.length; i++) {
                        newVal += valArr[i];
                    }
                    $("input[name='successDataId']").val(newVal);
                }
            }
        });


    });
</script>
</body>
</html>